<?php

class CamposHelper extends Helper {
     public function montar( $parrCamp ) 
     {
     	$sReturn = '';

		switch( $parrCamp['cmps_tipo'] )
		{
			case 'TEXTO':
				$sReturn = $this->montarTexto( $parrCamp['cmps_chave'], $parrCamp['cmps_nome'] );
				break;
			case 'EMAIL':
				$sReturn = $this->montarEmail( $parrCamp['cmps_chave'], $parrCamp['cmps_nome'] );
				break;
			case 'TELEFONE':
				$sReturn = $this->montarTelefone( $parrCamp['cmps_chave'], $parrCamp['cmps_nome'] );
				break;
			case 'SEXO':
				$sReturn = $this->montarSexo();
				break;
			case 'ESTADO':
				$sReturn = $this->montarEstado();
				break;
		}

		return $this->output( $sReturn );
     }
     
     private function montarTexto( $piChave, $psCampo )
     {
     	return $this->montarInput( $piChave, $psCampo, "required" );
     }
     
     private function montarEmail( $piChave, $psCampo )
     {
     	return $this->montarInput( $piChave, $psCampo, "email" );
     }
     
     private function montarTelefone( $piChave, $psCampo )
     {
     	return $this->montarInput( $piChave, $psCampo, "telefone" );
     }
     
     private function montarInput( $piChave, $psCampo, $psClasses )
     {
     	return '<input name="lead_'.$piChave.'" type="text" class="'.$psClasses.'" default="'.$psCampo.'" value="'.$psCampo.'" onblur="if(this.value==\'\') this.value=\''.$psCampo.'\';" onfocus="if(this.value==\''.$psCampo.'\') this.value=\'\';">';
     }
     
     private function montarSexo()
     {
     	return "<select name='lead_sexo' size='1' default='Sexo'>
			<option value='M'>Masculino</option>
			<option value='F'>Feminino</option>
		</select>";
     }
     
     private function montarEstado()
     {
     	return '<select name="lead_estado" class="required" default="Estado">
			<option value="AC">AC</option>
			<option value="AL">AL</option>
			<option value="AM">AM</option>
			<option value="AP">AP</option>
			<option value="BA">BA</option>
			<option value="CE">CE</option>
			<option value="DF">DF</option>
			<option value="ES">ES</option>
			<option value="GO">GO</option>
			<option value="MA">MA</option>
			<option value="MG">MG</option>
			<option value="MS">MS</option>
			<option value="MT">MT</option>
			<option value="PA">PA</option>
			<option value="PB">PB</option>
			<option value="PE">PE</option>
			<option value="PI">PI</option>
			<option value="PR">PR</option>
			<option value="RJ">RJ</option>
			<option value="RN">RN</option>
			<option value="RO">RO</option>
			<option value="RR">RR</option>
			<option value="RS">RS</option>
			<option value="SC">SC</option>
			<option value="SE">SE</option>
			<option value="SP">SP</option>
			<option value="TO">TO</option>
		</select>';
     }
}

?>